# gs1-wasm

A webassembly package written in Rust that exports the [GS1 crate](https://crates.io/crates/gs1) and adds some convenience features for batch processing. It uses [wasm-pack](https://rustwasm.github.io/docs/wasm-pack) for building.

## Usage

Because WebAssembly is meant to be loaded asynchronous, an extra step is necessary to use this library. Assuming a webpack environment that supports `import()`:

```js
// loading the package returns a promise
const loadGS1 = import('gs1-wasm')
loadGS1.then(gs1 => {
  /* use library */
})
```

## Building

To build the package, `wasm-pack` is used. You also need to make sure that you have the _wasm32-unknown-unknown_ target installed:

```sh
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
```

Now the package can be build with `wasm-pack build`.
